﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Data.SqlClient;
using Pheonix.CodeLibrary.Data;

/// <summary>
/// Summary description for TopShops
/// </summary>
namespace Pheonix.Fashionzoomer.CustomEntity
{
    [System.ComponentModel.DataObject]
    public sealed class TopShops : SqlServerDAO
    {
        private string _shopName;
        private int _shopId;

        public string ShopName
        {
            get { return _shopName; }
            set { _shopName = value; }
        }

        public int ShopId
        {
            get { return _shopId; }
            set { _shopId = value; }
        }

        public TopShops() { }

        public TopShops(string shopName, int shopId)
        {
            this._shopId = shopId;
            this._shopName = shopName;
        }

        public List<TopShops> GetTopShopList()
        {
            List<TopShops> topShopList = new List<TopShops>();

            SqlCommand sqlCmd = new SqlCommand();

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SPR_CUSTOM_GETTOPSHOPLIST);

            DataTable table = GetTableData(sqlCmd);

            foreach (DataRow row in table.Rows)
            {
                topShopList.Add(new TopShops(row["shop_name"].ToString(), Convert.ToInt32(row["id"])));
            }

            return topShopList;
        }

        private const string SPR_CUSTOM_GETTOPSHOPLIST = "spr_Custom_GetTopShopList";
    }
}